package www.bwsensing.com.common.netty.initializer;

import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import www.bwsensing.com.common.netty.handler.NettyUdpServerHandler;

/**
 * @author macos-zyj
 */
public class NettyUdpInitializer extends ChannelInitializer<Channel> {

    private final NettyUdpServerHandler nettyUdpServer;

    public NettyUdpInitializer(NettyUdpServerHandler nettyUdpServer) {
        this.nettyUdpServer = nettyUdpServer;
    }

    @Override
    protected void initChannel(Channel channel) throws Exception {
        ChannelPipeline pipeline = channel.pipeline();
        pipeline.addLast(nettyUdpServer);
    }
}
